﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>RDIFramework.NET（基于.NET快速信息化系统开发框架）- 用户登录</title>
    <link href="css/sexybuttons.css" rel="stylesheet" type="text/css" />
    <link href="css/mainlogin.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="Scripts/qqmsg/jQuery.qqmsg.js"></script>
    <link href="Scripts/Selectui/select2css.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/Selectui/select2css.js" type="text/javascript"></script>
    <script src="Scripts/jQuery.Overlay.js" type="text/javascript"></script>
    <script src="Scripts/jQuery.cookie.js" type="text/javascript"></script>
    <script type="text/javascript">

        function login() {
            var txtUserName = $("#txtUserName");
            var txtPassword = $("#txtPassword");
            var txtSystemType = $('#txtSystemType');
            var saveCookieDays = $('#ddlcookdays').val();

            var wsize = getsize();
            //$('body').showLoading({ 'overlayHeight': wsize.height });
            if (txtSystemType.val() == "") {
                alert("请输入要登录的系统！");
                txtSystemType.focus();
                return false;
            }else if (txtUserName.val() == "") {
                alert("请输入用户名！");
                txtUserName.focus();
                return false;
            } else if (txtPassword.val() == "") {
                alert("请输入密码！");
                txtPassword.focus();
                return false;
            } else{
                $.ajax({
                    type: "post",
                    url: "/ajax/login.ashx",
                    data: "uName=" + txtUserName.val() + "&uPwd=" + txtPassword.val() + "&cookieDay=" + saveCookieDays + "&systemType=" + txtSystemType.val(),
                    beforeSend: function () { $.RightOverlay.show(); $('#btnLogin').attr('disabled', 'true'); }, //发送数据之前
                    complete: function () { $.RightOverlay.hide(); $('#btnLogin').removeAttr('disabled'); }, //接收数据完毕
                    success: function (msg) {
                        //alert(msg);
                        if (msg == "1") {
                            $.cookie('RDIFramework_SystemType', txtSystemType.val());
                            location.href = "Default.aspx";
                        }
                        else if (msg == "0") {
                            alert('用户名或密码不正确！');                         
                            return false;
                        }
                        else if (msg == "2") {
                            alert('对不起此用户已被管理员锁定！您无法登录。！');                       
                            return false;
                        } else
                           alert(msg);
                    }               
                });
            }

        }

        function getsize() {
        var windowHeight = 0;
        var widowWidth = 0;
        if (typeof (window.innerHeight) == 'number') {
            windowHeight = window.innerHeight;
            widowWidth = window.innerWidth;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                windowHeight = document.documentElement.clientHeight;
                widowWidth = document.documentElement.clientWidth;
            }
            else {
                if (document.body && document.body.clientHeight) {
                    windowHeight = document.body.clientHeight;
                    widowWidth = document.body.clientWidth;
                }
            }
        }

        return { width: widowWidth, height: windowHeight };
    }


    $(function () {
         $("#txtSystemType").val('RDIFramework.NET');
         //$('#txtSystemType').val($.cookie('RDIFramework_SystemType'));
         $('#btnLogin').click(function () { login(); return false; });
         $('#txtUserName').focus();
        //响应键盘的回车事件
        $(this).keydown(function (event) {
            if (event.keyCode == 13) {
                event.returnValue = false;
                event.cancel = true;
                return login();
            }
        });
    })
	
    </script>
</head>
<body>
    <div id="LoginCircle">
        <div id="LoginDoc">
            <div id="SysName"></div>            
            <form method="post">
                <div id="SysInput">
                    <ul>
                        <li>登录系统：</li>
                        <li>
                            <input id="txtSystemType" name="SystemType" value="RDIFramework.NET" type="text" class="InputStyle" maxlength="18" /></li>
                    </ul>
                    <ul>
                        <li>用户名：</li>
                        <li>
                            <input id="txtUserName" name="username" value="Administrator" type="text" class="InputStyle" maxlength="18"  /></li>
                    </ul>
                    <ul>
                        <li>密&nbsp;&nbsp;&nbsp;码：</li>
                        <li>
                            <input name="password"  class="InputStyle" value="Administrator" id="txtPassword"  /></li>
                    </ul>
                    <ul>
                        <li>&nbsp;</li>
                        <li><div id="uboxstyle">
                            <select id="ddlcookdays"  name="DropExpiration">
                                <option value="0">不保存</option>
                                <option value="7">保存7天</option>
                                <option value="30">保存30天</option>
                                <option value="365">保存1年</option>
                            </select></div></li>
                    </ul>
                    <ul>
                        <li>&nbsp;</li>
                        <li>
                        <div style="width:170px; text-align:left">
                        <button class="sexybutton" id="btnLogin"><span><span><span class="usergo">登录</span></span></span></button>&nbsp;<button class="sexybutton" type="reset"><span><span><span class="reload">重置</span></span></span></button>	
                        </div>
                        </li>
                    
                    </ul>
                </div>
            </form>
            <div class="clear">
            </div>
        </div>
    </div>
    <div id="Copy">
       <font color="red">RDIFramework.NET</font> Version 2.5 Copyright &copy; 1998~2013 By EricHu
    </div>
</body>
</html>
